Skip to content

fix(completion): use InsertAsSnippet for query language commands#416

Merged
Blankll merged 1 commit into
masterfrom
fix/query-command-snippet-completion
May 9, 2026
Merged

fix(completion): use InsertAsSnippet for query language commands#416
Blankll merged 1 commit into
masterfrom
fix/query-command-snippet-completion

Conversation

@Blankll
Copy link
Copy Markdown
Member

@Blankll Blankll commented May 8, 2026

Summary

  • Fix snippet placeholder ($0) leaking into query language command completions
  • Change insertTextRules from None to InsertAsSnippet for command keywords

Problem

When accepting completions for query language commands (ESQL, SQL, EQL, PPL) inside the query body field of _query, _sql, _eql/search, and _plugins/_ppl endpoints, the literal text $0 was inserted into the editor.

For example, completing WHERE produced WHERE $0 instead of WHERE with cursor positioned after it.

Root Cause

The command definitions use Monaco snippet placeholders in their insertText:

{ label: 'WHERE', insertText: 'WHERE $0', ... }

But the completion provider used InsertTextRule.None, which inserts text literally without interpreting snippet syntax.

Fix

Changed insertTextRules at completionProvider.ts:764:

- insertTextRules: monaco.languages.CompletionItemInsertTextRule.None,
+ insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,

This affects all four query languages: ESQL, SQL, EQL, and PPL.

Verification

  • ✅ ESLint clean
  • ✅ TypeScript type check clean
  • ✅ No other instances of this bug in the codebase (audited all insertTextRules usages)

Refers: #412

Query language commands (ESQL, SQL, EQL, PPL) use $0 snippet placeholders
in their insertText, but the completion provider was inserting them as
plain text (InsertTextRule.None). This caused literal $0 to appear in the
editor when accepting completions like WHERE, FROM, SELECT, etc.

Changed insertTextRules from None to InsertAsSnippet so Monaco correctly
interprets the snippet placeholders.

Fixes #412
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.68%. Comparing base (01307b8) to head (d8a6967).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #416   +/-   ##
=======================================
  Coverage   64.68%   64.68%           
=======================================
  Files          47       47           
  Lines        2308     2308           
  Branches      597      597           
=======================================
  Hits         1493     1493           
  Misses        698      698           
  Partials      117      117           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Blankll Blankll merged commit d0708ed into master May 9, 2026
6 checks passed
@Blankll Blankll deleted the fix/query-command-snippet-completion branch May 9, 2026 09:31
Blankll added a commit that referenced this pull request May 19, 2026
…onfig CTA in chat panel

- completionProvider.ts: restore InsertAsSnippet for query language command
  completions (ESQL/SQL/EQL/PPL) — matches origin 1f914c9 and aligns with
  PR #416 fix; ultimate had re-introduced the None regression
- chat-panel.vue: restore 'Configure GPT' settings CTA button in error
  banner when AI is not configured, matching origin chatbot-box behavior;
  add useRouter import and error-settings-btn CSS
Blankll added a commit that referenced this pull request May 19, 2026
…dio view (#431)

## Summary

Syncs AI/agent improvements from the private `ultimate` branch into the
public repo.

### What's included

**Rust agent backend** (`src-tauri/src/agent/`)
- Multi-provider LLM agent with loop runner, tool executor, session
store (SQLite via rusqlite)
- Supports OpenAI, DeepSeek, OpenRouter, Ollama, LM Studio
- Replaces the old `openai_client` module (removed)
- New Tauri commands: `start_agent_session`, `send_agent_message`,
`validate_llm_config`, `list_llm_models`, etc.

**Data Studio view** (`src/views/data-studio/`)
- Full chat-driven data exploration interface
- Session history, tool confirmation cards, source management modals

**Agent composables & stores**
- `useAgentContext`, `useChatAgent`, `useSidebarChatAgent`,
`useDataStudioAgent`, `useDataStudioChatAgent`
- `dataStudioStore`, `codeActionStore`
- `appStore`: `ProviderConfig`, `ModelRef`, `getResolvedFeatureModel`
for multi-provider support; migrates legacy `aiConfigs` secret to new
`LlmSettings` on first load

**Shared agent UI components**
- `agent-message-bubble`, `chat-panel` (with missing-AI-config CTA),
`model-picker`

**AI settings** (`src/views/setting/components/aigc.vue`)
- Replaced per-provider tabs (OpenAI / DeepSeek) with unified
multi-provider settings
- Supports all five providers: OpenAI, DeepSeek, OpenRouter, Ollama, LM
Studio
- System prompt is now dynamically built from live database schema
context (richer than the static user-editable prompt in origin)

**Accessibility & UX improvements**
- `SearchableSelect`: full keyboard navigation (arrow keys, Enter,
Escape, ARIA)
- `path-breadcrumb`, `tool-bar-right`: keyboard + ARIA accessibility
- `DialogContent`: pointer-events fix for closed overlay
- Monaco `completionProvider`: `InsertAsSnippet` for query language
commands (ESQL/SQL/EQL/PPL) — aligns with #416
- Sidebar chat `chatbot-box`: resizable panel, session history, upgraded
to agent-based architecture

**i18n**: agent/data-studio keys added to `enUS` and `zhCN`

**MongoDB: always visible**
- Removed `VITE_FEATURE_MONGODB` feature flag and `__MONGODB_ENABLED__`
Vite define
- MongoDB is now shown in all environments (dev and production)
- `featureFlags.ts` retained for compatibility but no longer gates
MongoDB

### What's excluded
- All login/auth/Geekfun account features
- `authService.ts`, login views, `orContinueWith`/`loginWithGeekfun`
i18n keys

### What's preserved from origin
- Full MongoDB support (`mongo_client.rs`, `mongoApi.ts`, mongo editor)
- All DynamoDB extended features
(delete/truncate/update-table-config/pitr/streams/ttl modules)
- Origin's `connectionStore.ts` (has OpenSearch, EasySearch, MongoDB
types — ahead of ultimate)
- Origin's `fetch_client.rs` (OnceLock-based, safer than ultimate's
static mut version)
- `featureFlags.ts` + its tests (no longer gates MongoDB, but preserved)
- All keyboard accessibility and OpenSearch/EasySearch guards in
import/export views

### Verification
- `tsc --noEmit` ✅
- `eslint` ✅ (0 errors)
- `jest` ✅ 31 suites / 1280 tests

---------

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant